import { Button, Empty, Space, Radio, Checkbox, InputNumber, Table, Menu, Tabs } from 'antd';
import { useState, useEffect, useContext } from 'react'
import ZhpgContext from '../ZhpgContext';
import useBusinessMap from '../../../../../common/BusinessMap/useBusinessMap';
import { drawCircle, wktToGeom } from '../../../../../../utils/helper/mapHelper';
import { fromCircle } from 'ol/geom/Polygon';
import CztApi from '../../../../../../utils/apis/CztApi';
import JzzyApi from '../../../../../../utils/apis/JzzyApi';
import LittleTitle from '../../../../../common/LittleTitle';
import ScrollTable from '../../../../../common/ScrollTable';
import Children from './Children';
import rangeDisplayIcon from '../../Jcyj/rangeDisplayIcon';
export default function Zhjc(props) {

    const { zhData, zhjcData } = useContext(ZhpgContext);
    // if (!zhData) {
    //     return <Empty description="请先选择灾害数据" image={Empty.PRESENTED_IMAGE_SIMPLE}></Empty>
    // }
    // const { setYxfxradius, setXqzt, setYxfxxq, setYxfxxq1, setZhjcData } = props.setdataObj;
    //setZhjcData(2);
    //const [cztList, setCztList] = useState();
    const [jzzyList, setJzzyList] = useState();
    const map = useBusinessMap();
    const [items, setItems] = useState([
        {
            label: '救援队伍',
            key: 'jydw',
            filter: (item) => {
                return item.name?.indexOf('救援') > -1
            }
        }, {
            label: '避难场所',
            key: 'bncs',
            filter: (item) => {
                return item.name?.indexOf('应急避难所') > -1
            }
        }, {
            label: '物资储备点',
            key: 'wzcbd',
            filter: (item) => {
                return item.name?.indexOf('物资储备') > -1
            }
        }

    ]);
   

    const handleButtonClick = (record) => {
        //console.log('1',jzzyList);
        // setXqzt(2);
        // setYxfxxq([record, jzzyList]);
        // setZhjcData({ radius: radius, datas: jzzyList })
    }
  
    

    if (!zhData) {
        return <Empty description="请先选择灾害数据" image={Empty.PRESENTED_IMAGE_SIMPLE}></Empty>
    }



    return <div>
        <Space direction='vertical' style={{ width: '100%' }}>
            <Tabs items={items.map(item => {
                return {
                    ...item,
                    children: <Children {...props} item={item} onChange={result => {
                        props.onCompleted?.({
                            ...zhjcData,
                            [item.key]: {
                                ...result
                            }
                        })
                    }} />
                }
            })}></Tabs>

        </Space>
    </div>
}